superstrict

import BRL.Stream

import "Table.bmx"

type Database

	'// -----------------------------------------------------------------------------------------------------------------
	'// 
	'// -----------------------------------------------------------------------------------------------------------------
	method getDatabase:Database(name:string)
	
		if (m_databaseMap.contains(name)) ..
			return Database(m_databaseMap.valueForKey(name));
		
		return null;
	
	end method
	
	'// -----------------------------------------------------------------------------------------------------------------
	'// 
	'// -----------------------------------------------------------------------------------------------------------------
	method getTable:Table(name:string)
	
		if (m_tableMap.contains(name)) ..
			return Table(m_tableMap.valueForKey(name));
		
		return null;
	
	end method
	
	'// -----------------------------------------------------------------------------------------------------------------
	'// 
	'// -----------------------------------------------------------------------------------------------------------------
	method saveToDisc(filestream:TStream)
	
		
	
	end method
	
	'// -----------------------------------------------------------------------------------------------------------------
	'// 
	'// -----------------------------------------------------------------------------------------------------------------
	method pushDatabase(db:Database)
	
		if (not db) ..
			return;
		
		m_databaseList.addLast(db);
		m_databaseMap.insert(db.m_name, db);
	
	end method
	
	'// -----------------------------------------------------------------------------------------------------------------
	'// 
	'// -----------------------------------------------------------------------------------------------------------------
	method pushTable(t:Table)
	
		if (not t) ..
			return;
		
		m_tableList.addLast(t);
		m_tableMap.insert(t.m_name, t);
	
	end method
	
	'// -----------------------------------------------------------------------------------------------------------------
	'// 
	'// -----------------------------------------------------------------------------------------------------------------
	method getName:string()
	
		return m_name;
	
	end method
	
	'// -----------------------------------------------------------------------------------------------------------------
	'// 
	'// -----------------------------------------------------------------------------------------------------------------
	field m_name:string;
	
	'// -----------------------------------------------------------------------------------------------------------------
	'// 
	'// -----------------------------------------------------------------------------------------------------------------
	field m_databaseList:TList = new TList;
	field m_databaseMap:TMap = new TMap;
	
	'// -----------------------------------------------------------------------------------------------------------------
	'// 
	'// -----------------------------------------------------------------------------------------------------------------
	field m_tableList:TList = new TList;
	field m_tableMap:TMap = new TMap;

end type
